package com.atguigu.educms.controller.web;


import com.atguigu.common.R;
import com.atguigu.educms.entity.CmsContactInfo;
import com.atguigu.educms.entity.CmsLinks;
import com.atguigu.educms.service.CmsContactInfoService;
import com.atguigu.educms.service.CmsLinksService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 友情链接前台 前端控制器
 * </p>
 *
 * @author Panghl
 * @since 2021-03-11
 */
@RestController
@RequestMapping("/educms/cms-links")
@Api(tags = {"友情链接-前台"})
public class CmsLinksFrontController {

    @Autowired
    private CmsLinksService linksService;

    @Autowired
    private CmsContactInfoService contactInfoService;

    @ApiOperation(value = "获取友情链接信息")
    @GetMapping("/getAllLinks")
    public R getLinks(){
        List<CmsLinks> links = linksService.getAllLinks();
        CmsContactInfo contact = contactInfoService.getContact();
        return R.ok().data("list",links).data("contact",contact);
    }
}
